package com.wm.book;

import java.util.ArrayList;
public class Book implements Comparable{
    private String name;
    private double price;

    public Book() {
    }

    public Book(String name, double price) {
        this.name = name;
        this.price = price;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    @Override
    public int compareTo(Object o) {
        Book b = (Book)o;
        if (b.getPrice() > this.getPrice()){
            return -1;
        }else if (b.getPrice() < this.getPrice()){
            return 1;
        }else {
            return 0;
        }
    }
}
